home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16269 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  893 b 

  1. Path: jth.ping.de!jth
  2. Date: 09 Apr 1996 14:20:00 +0100
  3. From: jth@jth.ping.de (Jens Theisen)
  4. Newsgroups: comp.lang.c++
  5. Message-ID: <66W1XonUoNB@jth.ping.de>
  6. References: <Andreas.Ernst-0704960918430001@grumari.bonn.netsurf.de>
  7. Subject: Re: fastest way to detect int overflow
  8. X-Newsreader: CrossPoint v3.1
  9.  
  10. Andreas.Ernst@bonn.netsurf.de wrote:
  11. > What is the fastest way to detect arithmetic operations causing an overflow?
  12. > It works by doing some arithmetic with MAX/MIN_<...>, but this seems way
  13. > too slow to me. Isn't there a better way ( like checking the carry bit in
  14. > a portable way???).
  15. >
  16. > Thanks, Andreas
  17. >
  18. > --
  19. > still under construction
  20.  
  21. If you mean with "portable way" that you want to have a real C++ -  
  22. solution, I can't help you. Otherwise, if you are programming on PCs, try  
  23. Inline-Assembler. The 80x86 have a special carry-flag for ints, the  
  24. overflow-flag.
  25.  Jens Theisen
  26.  
  27.